***** FINAL REGRESSIONS RAYON DATASET
gen industrial_emp =(modern_m + modern_f) *100 / (total_m + total_f)
gen intellectual_emp = (intellectuals_m + intellectuals_f) * 100 / (total_m + total_f)
gen ll=(light_m+light_f)*100/(total_m+total_f)
gen ss=(small_m+small_f)*100/(total_m+total_f)
gen teach = (teachers_m + teachers_f)* 100 / (total_m+total_f)
gen lawyers = (lawyers_m + lawyers_f)* 100 / (total_m+total_f)
gen scientists = (scientists_m + scientists_f)* 100 / (total_m+total_f)
gen rantie = (rantie_m + rantie_f)* 100 / (total_m+total_f)
gen docts = (doctors_m + doctors_f)*100 /(total_m+total_f)
gen trade_emp =(trade_m + trade_f)*100 / (total_m + total_f)
gen admempl = (administrators_m + administrators_f)*100 / (total_m + total_f)
gen teach_m = teachers_m * 100 / (total_m)
gen teach_f = teachers_f * 100 / (total_f)
gen docts_m = doctors_m * 100 / (total_m)
gen docts_f = doctors_f * 100 / (total_f)
gen adm_m = (administrators_m )*100 / total_m
gen traders_m = trade_m*100 / total_m
gen law_m = lawyers_m*100 /total_m
gen intellect_m = intellectuals_m*100 / total_m
gen rent_m = rantie_m*100 / total_m
gen adm_f = (administrators_f)*100 / total_f
gen traders_f = trade_f*100 / total_f
gen law_f = lawyers_f*100 /total_f
gen intellect_f = intellectuals_f*100 / total_f
gen rent_f = rantie_f*100 / total_f
gen l_m = light_m *100/ total_m
gen l_f = light_f *100/ total_f
gen s_m = small_m *100/ total_m
gen s_f = small_f *100/ total_f
gen trades_m =(trade_m )*100 / (total_m )
gen trades_f =(trade_f )*100 /(total_f )
tab region_cod, gen(dreg)

*** Table 1
* undconditional correlation
reg democ_vanhanen_96 perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
* modernization
reg democ_vanhanen_96 perc_estmeshchane  industrial_emp dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane industrial_emp dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
* other religious factors
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
* geography
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
* contemporary controls
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude urbanization housing doctors dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude urbanization housing doctors dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

*** Table 3
reg educ perc_estmeshchane dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg educ  perc_estmeshchane industrial_emp dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg educ  perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew  dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg educ  perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew  urbanization dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg educ  perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew  urbanization housing doctors latitude longitude  dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg educ  perc_estmeshchane income dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg educ  perc_estmeshchane, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

reg educ perc_estmeshchane dreg1-dreg79  , robust
psacalc delta perc_estmeshchane


*** Figure 1
correl intellectual_emp perc_estmeshchane
correl intellect_m perc_estmeshchane
correl intellect_f perc_estmeshchane
correl docts perc_estmeshchane
correl docts_m perc_estmeshchane
correl docts_f perc_estmeshchane
correl teach perc_estmeshchane
correl teach_m perc_estmeshchane
correl teach_f perc_estmeshchane
correl lawyers perc_estmeshchane
correl law_m perc_estmeshchane
correl law_f perc_estmeshchane

*** Figure 4
correl perc_estmeshchane ll
correl perc_estmeshchane l_m
correl perc_estmeshchane l_f
correl perc_estmeshchane ss
correl perc_estmeshchane s_m
correl perc_estmeshchane s_f
correl perc_estmeshchane trade_emp
correl perc_estmeshchane trades_m
correl perc_estmeshchane trades_f
correl perc_estmeshchane rantie
correl perc_estmeshchane rent_m
correl perc_estmeshchane rent_f

*** Appendix
* Exclude region FE
reg democ_vanhanen_96 perc_estmeshchane urbanization , robust
reg efnumk_96 perc_estmeshchane urbanization , robust
* Use clustered SE
reg democ_vanhanen_96 perc_estmeshchane urbanization  dreg1-dreg79 , robust cluster(region_code)
reg efnumk_96 perc_estmeshchane urbanization dreg1-dreg79 , robust cluster(region_code)
* MVRS
mvrs reg democ_vanhanen_96 urbanization perc_estmeshchane  latitude longitude , robust knots(perc_estmeshchane: 0)
mvrs reg efnumk_96 urbanization perc_estmeshchane latitude longitude , robust knots(perc_estmeshchane: 0)
* Robust regressions
rreg democ_vanhanen_96 perc_estmeshchane urbanization  dreg1-dreg79 
rreg efnumk_96 perc_estmeshchane urbanization  dreg1-dreg79 
* Median regressions
bsqreg democ_vanhanen_96 perc_estmeshchane urbanization  , reps(100)
bsqreg efnumk_96 perc_estmeshchane urbanization  , reps(100)
* Exclude purely urban districts
reg democ_vanhanen_96 perc_estmeshchane urbanization  dreg1-dreg79  if urbanization<60, robust
reg efnumk_96 perc_estmeshchane urbanization  dreg1-dreg79  if urbanization<60, robust
* Exclude ethnic regions
reg democ_vanhanen_96 urbanization perc_estmeshchane dreg1-dreg79 if region_code<82 & region_code>22 , robust 
reg efnumk_96 urbanization perc_estmeshchane dreg1-dreg79 if region_code<82 & region_code>22 , robust 
* Exclude Moscow and Leningrad oblast
reg democ_vanhanen_96 urbanization perc_estmeshchane dreg1-dreg79 if region_code!=50 & region_code!=53 , robust 
reg efnumk_96 urbanization perc_estmeshchane dreg1-dreg79 if region_code!=50 & region_code!=53 , robust 
* Exclude Chechnya and Ingushetia
reg democ_vanhanen_96 urbanization perc_estmeshchane dreg1-dreg79 if region_code!=6 & region_code!=21 , robust 
reg efnumk_96 urbanization perc_estmeshchane dreg1-dreg79 if region_code!=6 & region_code!=21 , robust 
* Control for income
reg democ_vanhanen_96 urbanization perc_estmeshchane dreg1-dreg79 income , robust 
reg efnumk_96 urbanization perc_estmeshchane dreg1-dreg79 income , robust 
* Control for population
reg democ_vanhanen_96 urbanization perc_estmeshchane dreg1-dreg79 population , robust 
reg efnumk_96 urbanization perc_estmeshchane dreg1-dreg79 population , robust 
* Control for education
reg democ_vanhanen_96 urbanization perc_estmeshchane dreg1-dreg79 educ , robust 
reg efnumk_96 urbanization perc_estmeshchane dreg1-dreg79 educ , robust 
* Control for three Russia dummies
reg democ_vanhanen_96 urbanization perc_estmeshchane dreg1-dreg79 first_russia second_russia fourth_russia , robust 
reg efnumk_96 urbanization perc_estmeshchane dreg1-dreg79 first_russia second_russia fourth_russia  , robust 

* Retail  trade
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude retrade dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude retrade dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude retrade dreg1-dreg79 population , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude retrade dreg1-dreg79 population  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Population weights
* undconditional correlation
reg democ_vanhanen_96 perc_estmeshchane dreg1-dreg79  [pweight=population], robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane dreg1-dreg79  [pweight=population], robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
* geography and historical variables
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79  [pweight=population], robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79  [pweight=population], robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

** Endogeneity bias
reg democ_vanhanen_96 perc_estmeshchane dreg1-dreg79 , robust
konfound perc_estmeshchane
reg democ_vanhanen_96 perc_estmeshchane dreg1-dreg79 , robust
psacalc delta perc_estmeshchane

reg efnumk_96 perc_estmeshchane dreg1-dreg79 , robust
konfound perc_estmeshchane
reg efnumk_96 perc_estmeshchane dreg1-dreg79 , robust
psacalc delta perc_estmeshchane

** Urbanization
* undconditional correlation
reg democ_vanhanen_96 perc_estmeshchane imp_urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane imp_urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
* geography
reg democ_vanhanen_96 perc_estmeshchane imp_urbanization industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane imp_urbanization industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
* Effect on education
reg educ  perc_estmeshchane imp_urbanization dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Other city characteristics
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_stone_buildings , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_stone_buildings, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 hospitals_and_clinics_places , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 hospitals_and_clinics_places, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_telephone_abonnents , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_telephone_abonnents, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 yarmark_oborot , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 yarmark_oborot, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 revenue , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 revenue, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_stone_buildings hospitals_and_clinics_places no_telephone_abonnents yarmark_oborot revenue , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_stone_buildings hospitals_and_clinics_places no_telephone_abonnents yarmark_oborot revenue, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Outliers
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_stone_buildings if no_stone_buildings<4000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_stone_buildings  if no_stone_buildings<4000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 hospitals_and_clinics_places if hospitals_and_clinics_places < 5000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 hospitals_and_clinics_places if hospitals_and_clinics_places < 5000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_telephone_abonnents  if no_telephone_abonnents < 10000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 no_telephone_abonnents if no_telephone_abonnents < 10000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 yarmark_oborot if yarmark_oborot < 4000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 yarmark_oborot if yarmark_oborot < 4000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 revenue if revenue < 10000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane  industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude dreg1-dreg79 revenue if revenue < 10000, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Differences in the meshchane size
reg perc_estmeshchane imp_urbanization latitude longitude, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg perc_estmeshchane imp_urbanization latitude longitude perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg perc_estmeshchane imp_urbanization latitude longitude yarmark_oborot, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg perc_estmeshchane imp_urbanization latitude longitude revenue, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Other educated classes
gen educclass = perc_estmeshchane + perc_est_dvoryane + perc_est_dukhovenstvo + perc_estate_kuptsy 
reg democ_vanhanen_96 educclass dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 educclass dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 educclass dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 educclass  dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
* other educated estates
reg democ_vanhanen_96 perc_estmeshchane perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_foreignnationals dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_foreignnationals dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_foreignnationals dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_foreignnationals dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Correlations and figures
pwcorr  perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane

hist perc_est_dvoryane, saving (A)
hist perc_est_dukhovenstvo, saving (B)
hist perc_estate_kuptsy, saving (C)
hist perc_estmeshchane, saving (D)
gr combine A.gph B.gph C.gph D.gph

hist perc_est_dvoryane, xscale(range(0 30)) saving (A1)
hist perc_est_dukhovenstvo, xscale(range(0 30)) saving (B1)
hist perc_estate_kuptsy, xscale(range(0 30)) saving (C1)
hist perc_estmeshchane, xscale(range(0 30)) saving (D1)
gr combine A1.gph B1.gph C1.gph D1.gph

gen sharemeshchane = perc_estmeshchane *100 / educclass
hist sharemeshchane

* Merging merchants and meshchane
gen traders = perc_estmeshchane + perc_estate_kuptsy
reg democ_vanhanen_96 traders dreg1-dreg79 , robust
est store A1
reg efnumk_96 traders dreg1-dreg79 , robust
est store A2
reg democ_vanhanen_96 traders dreg1-dreg79 industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude , robust
est store C1
reg efnumk_96 traders dreg1-dreg79 industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude , robust
est store C2
replace traders = perc_estmeshchane
reg democ_vanhanen_96 traders dreg1-dreg79 , robust
est store B1
reg efnumk_96 traders dreg1-dreg79  , robust
est store B2
reg democ_vanhanen_96 traders dreg1-dreg79 industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude , robust
est store D1
reg efnumk_96 traders dreg1-dreg79 industrial_emp perc_rel_oldbel perc_rel_cath perc_rel_prot perc_rel_jew latitude longitude , robust
est store D2
coefplot (A1, label(Merchants and meshchane)) (B1, label (Meshchane)), keep(traders) saving(g1)
coefplot (A2, label(Merchants and meshchane)) (B2, label(Meshchane)), keep(traders)  saving(g2)
coefplot (C1, label(Merchants and meshchane)) (D1, label (Meshchane)), keep(traders) saving(g3)
coefplot (C2, label(Merchants and meshchane)) (D2, label(Meshchane)), keep(traders)  saving(g4)
gr combine g1.gph g2.gph g3.gph g4.gph
drop traders

* Compare merchants and meshchane
reg democ_vanhanen_96 perc_estate_kuptsy dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estate_kuptsy dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estate_kuptsy urbanization dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estate_kuptsy urbanization dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane urbanization dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane urbanization dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Peasants as the residual group
reg democ_vanhanen_96 perc_estmeshchane perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_foreignnationals perc_estkrestyane dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_foreignnationals perc_estkrestyane dreg1-dreg79  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_foreignnationals perc_estkrestyane dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_foreignnationals perc_estkrestyane dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane perc_estkrestyane dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane perc_estkrestyane dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96  perc_estkrestyane dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96  perc_estkrestyane dreg1-dreg79 urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Administrative employment
reg democ_vanhanen_96 perc_estmeshchane admempl dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane admempl dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane  dreg1-dreg79  if admempl<2, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane  dreg1-dreg79  if admempl <2, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

correl perc_estmeshchane admempl
correl perc_estmeshchane adm_m
correl perc_estmeshchane adm_f

* Military
gen sharemil = (military_m + military_f) / (total_m + total_f)
pwcorr sharemil perc_estmeshchane, sig

reg sharemil imp_urbanization perc_estmeshchane, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg sharemil imp_urbanization perc_estmeshchane latitude longitude, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane sharemil dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane sharemil dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

drop sharemil

* Zemstvo
gen inter = perc_estmeshchane * old_zemstvo 
reg democ_vanhanen_96 perc_estmeshchane old_zemstvo urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane old_zemstvo urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane old_zemstvo inter urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane old_zemstvo inter urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
drop inter
gen zemstvo = old_zemstvo + new_zemstvo
gen inter = perc_estmeshchane * zemstvo
reg democ_vanhanen_96 perc_estmeshchane zemstvo urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane zemstvo urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 perc_estmeshchane zemstvo inter urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane zemstvo inter urbanization , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
drop zemstvo inter

* 1995 elections
reg efnump_95 perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnump_95 perc_estmeshchane urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnump_95 perc_estmeshchane urbanization dreg1-dreg79 housing doctors latitude longitude  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* 2012 elections
reg democ_vanhanen_12 perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_12 perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_12 perc_estmeshchane urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_12 perc_estmeshchane urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_12 perc_estmeshchane urbanization dreg1-dreg79 housing doctors latitude longitude  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_12 perc_estmeshchane urbanization dreg1-dreg79 housing doctors latitude longitude  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Other proxies of political behavior
reg _yeltsin perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg  _yavlinskiy  perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg putin_share perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg titkov_96 perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg titkov_12 perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

reg _yeltsin perc_estmeshchane urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg _yavlinskiy perc_estmeshchane urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg putin_share perc_estmeshchane urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg titkov_96 perc_estmeshchane urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg titkov_12 perc_estmeshchane urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

reg _yeltsin perc_estmeshchane urbanization dreg1-dreg79 housing doctors latitude longitude , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg _yavlinskiy perc_estmeshchane urbanization dreg1-dreg79 housing doctors latitude longitude , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg putin_share perc_estmeshchane urbanization dreg1-dreg79 housing doctors latitude longitude , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg titkov_96 perc_estmeshchane urbanization dreg1-dreg79 housing doctors latitude longitude , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg titkov_12 perc_estmeshchane urbanization dreg1-dreg79 housing doctors latitude longitude , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

pwcorr _yeltsin putin_share democ_vanhanen_96 democ_vanhanen_12 efnumk_96 efnumk_12 titkov_96 titkov_12

* Literacy and estates
pwcorr perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane literates, sig

reg literates perc_estmeshchane , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg literates perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg literates perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg literates perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals germans_dummy  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg literates perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals germans_population  , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg literates perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals longitude latitude , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

* Literacy and democracy
reg efnumk_96 literates dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg democ_vanhanen_96 literates dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 literates urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 literates urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 literates urbanization housing doctors latitude longitude dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 literates urbanization housing doctors latitude longitude dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

*** ZATO
*** Non-randomness of ZATO locations 
ttest literates, by(zato)
ttest perc_est_dvoryane, by(zato) 
ttest perc_est_dukhovenstvo, by(zato) 
ttest perc_estate_kuptsy, by(zato) 
ttest perc_estmeshchane, by(zato)
ttest perc_estkrestyane, by(zato) 
ttest perc_foreignnationals, by(zato)

*** Regressions
reg democ_vanhanen_96 perc_estmeshchane zato urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane zato urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 literates zato urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 literates zato urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 zato urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 zato urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

teffects psmatch (democ_vanhanen_96) (zato perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals)
teffects psmatch (efnumk_96) (zato perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals)
teffects psmatch (democ_vanhanen_96) (zato literates)
teffects psmatch (efnumk_96) (zato literates)
teffects psmatch (democ_vanhanen_96) (zato perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals urbanization)
teffects psmatch (efnumk_96) (zato perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals urbanization)
teffects psmatch (democ_vanhanen_96) (zato literates urbanization)
teffects psmatch (efnumk_96) (zato literates urbanization)

firthlogit zato  perc_estmeshchane latitude longitude

*** CONCENTRATION CAMPS
*** Non-randomness of camp locations 
ttest literates, by(lager)
ttest perc_est_dvoryane, by(lager) 
ttest perc_est_dukhovenstvo, by(lager) 
ttest perc_estate_kuptsy, by(lager) 
ttest perc_estmeshchane, by(lager)
ttest perc_estkrestyane, by(lager) 
ttest perc_foreignnationals, by(lager)

*** Regressions
reg democ_vanhanen_96 perc_estmeshchane lager urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane lager urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 literates lager urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 literates lager urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg democ_vanhanen_96 lager urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 lager urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

teffects psmatch (democ_vanhanen_96) (lager perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals)
teffects psmatch (efnumk_96) (lager perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals)
teffects psmatch (democ_vanhanen_96) (lager literates)
teffects psmatch (efnumk_96) (lager literates)
teffects psmatch (democ_vanhanen_96) (lager perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals urbanization)
teffects psmatch (efnumk_96) (lager perc_est_dvoryane perc_est_dukhovenstvo perc_estate_kuptsy perc_estmeshchane perc_foreignnationals urbanization)
teffects psmatch (democ_vanhanen_96) (lager literates urbanization)
teffects psmatch (efnumk_96) (lager literates urbanization)

firthlogit lager perc_estmeshchane latitude longitude

*** PLACEBO TEST: ETHNIC GERMANS
* Germans
reg democ_vanhanen_96 perc_estmeshchane germans_dummy urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)  ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane germans_dummy urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
*** Effects controlling for Russian Germans (literates)
reg democ_vanhanen_96 literates germans_dummy urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 literates germans_dummy urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
*** Effects controlling for Russian Germans (share of meshchange)
reg democ_vanhanen_96 perc_estmeshchane germans_population urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 perc_estmeshchane germans_population urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
*** Effects controlling for Russian Germans (literates)
reg democ_vanhanen_96 literates germans_population urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 literates germans_population urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
*** Direct effect (dummy)
reg democ_vanhanen_96 germans_dummy urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 germans_dummy urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
*** Direct effect (population)
reg democ_vanhanen_96  germans_population urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96  germans_population urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

**** Exclude outliers
*** Effects controlling for Russian Germans (share of meshchange)
reg democ_vanhanen_96 perc_estmeshchane germans_population urbanization  dreg1-dreg79  if germans_population < 40, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane germans_population urbanization dreg1-dreg79  if germans_population < 40, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
*** Effects controlling for Russian Germans (literates)
reg democ_vanhanen_96 literates germans_population urbanization  dreg1-dreg79  if germans_population < 40, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 literates germans_population urbanization dreg1-dreg79  if germans_population < 40, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
*** Direct effect (population)
reg democ_vanhanen_96  germans_population urbanization  dreg1-dreg79  if germans_population < 40, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96  germans_population urbanization dreg1-dreg79  if germans_population < 40, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

*** Census German population
*** Effects controlling for Russian Germans (share of meshchange)
reg democ_vanhanen_96 perc_estmeshchane census_germans urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)  ctitle(I) varlabels  replace
reg efnumk_96 perc_estmeshchane census_germans urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
*** Effects controlling for Russian Germans (literates)
reg democ_vanhanen_96 literates census_germans urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 literates census_germans urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
*** Direct effect (dummy)
reg democ_vanhanen_96 census_germans urbanization  dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg efnumk_96 census_germans urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

reg democ_vanhanen_96 census_germans urbanization  dreg1-dreg79  if census_germans <100, robust

teffects psmatch (democ_vanhanen_96) (germans_dummy latitude longitude population_total)
teffects psmatch (democ_vanhanen_96) (germans_dummy latitude longitude population_total) if germans_population < 40
teffects psmatch (efnumk_96) (germans_dummy latitude longitude population_total)

** Protest
reg protest_14_16 perc_estmeshchane dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  replace
reg protest_14_16 perc_estmeshchane urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg protest_14_16 perc_estmeshchane urbanization dreg1-dreg79  if urbanization >70, robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge
reg protest_14_16 literates urbanization dreg1-dreg79 , robust
outreg  using "fintabl1", se  bdec(3) starlevels(10 5 1) sigsymb(*,**,***)   ctitle(I) varlabels  merge

logit protest_14_16 perc_estmeshchane dreg1-dreg79 , robust
logit protest_14_16 perc_estmeshchane urbanization dreg1-dreg79 , robust
logit protest_14_16 perc_estmeshchane urbanization dreg1-dreg79  if urbanization >70, robust
logit protest_14_16 literates urbanization dreg1-dreg79 , robust

firthlogit protest_14_16 perc_estmeshchane  
firthlogit protest_14_16 perc_estmeshchane urbanization  
firthlogit protest_14_16 perc_estmeshchane urbanization  if urbanization >70
firthlogit protest_14_16 literates urbanization  

*** Old and new middle class
egen float e_dummy = cut(educ), group(2)
egen float m_dummy = cut( perc_estmeshchane), group(2)
by e_dummy m_dummy, sort: sum efnumk_96
by e_dummy m_dummy, sort: sum democ_vanhanen_96
